package kt.com.bilin.coin.ui.dialog

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.View
import com.bilin.coin.R
import kotlinx.android.synthetic.main.dialog_home_alert.*

class HomeAlertDialog(context: Context, private val title: String, private val message: String) : Dialog(context, R.style.dimLoadingdialog), View.OnClickListener {
    init {
        setContentView(R.layout.dialog_home_alert)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        tvTitle.text = title
        tvMessage.text = message
        positiveButton.setOnClickListener(this)
        window?.attributes?.run { width = (context.resources.displayMetrics.widthPixels * 0.75).toInt() }
    }

    override fun onClick(v: View?) {
        when (v) {
            positiveButton -> dismiss()
        }
    }
}
